//
//  NSObject+TY.h
//  高仿暴走斗图
//
//  Created by huangsongyao on 16/4/4.
//  Copyright © 2016年 huangsongyao. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "RegexKitLite.h"

@interface NSObject (TY)

/**
 *  创建文本编辑器
 *
 *  @param characterSpacing 字间距离
 *  @param linesSpacing     行间距离
 *  @param text             文本
 *  @param textColor        字体颜色
 *  @param font             字体大小
 *
 *  @return 文本编辑器实例对象
 */
+ (TYTextContainer *)createTextContainerWithCharacterSpacing:(unichar)characterSpacing andLinesSpacing:(CGFloat)linesSpacing text:(NSString *)text textColor:(UIColor *)textColor font:(UIFont *)font;

/**
 *  创建画布view
 *
 *  @param delegate      TYAttributedLabel Delegate
 *  @param textContainer TYTextContainer实例
 *  @param frame         AttributedLabel的frame
 *
 *  @return 画布view的实例
 */
+ (TYAttributedLabel *)createAttributedLabelForDelegate:(id<TYAttributedLabelDelegate>)delegate withTextContainer:(TYTextContainer *)textContainer frame:(CGRect)frame;

/**
 *  文本解析方法
 *
 *  @param string     要解析的文本
 *  @param usingBlock 解析文本后获取对应站位符的回调block，该block执行次数根据占位符数量决定
 */
+ (void)parseTextContainerForString:(NSString *)string withUsingBlock:(void(^)(NSInteger captureCount, NSString *const __unsafe_unretained *capturedStrings, const NSRange *capturedRanges, volatile BOOL *const stop))usingBlock;

@end
